<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>明细查询</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css"  media="all">
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right"><!--右侧内容-->
					<div class="rigtop">
						<span class="title">明细查询</span>
					</div>
					<div class="indrig_con">
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('count/detailed')}" method="post">
							<div class="zizh_con_1">
								<div class="shxx_row chax_row clearfix">
						            <div class="left">交易时间：</div>
						            <div class="right clearfix">
						                <div class="layui-inline">
									      <div class="layui-input-inline">
									        <input type="text" class="layui-input" name="begin_time" id="begin_time" placeholder="yyyy年MM月dd日">
									      </div>
									    </div>
						                <i class="chax_line"></i>
						                <div class="layui-inline">
									      <div class="layui-input-inline">
									        <input type="text" class="layui-input" name="end_time"  id="end_time" placeholder="yyyy年MM月dd日">
									      </div>
									    </div>
						            </div>
						        </div>
						       
								<div class="chax_rowbox clearfix">
									<div class="shxx_row clearfix">
							            <div class="left">门店：</div>
							            <div class="right clearfix">
											<div  id="htselect">
												<select name="store_name" id="store_name" onchange="store_change(this.options[this.options.selectedIndex].value)">
													<option value="">全部</option>
													{volist name="agent_store" id="vo"}
														<option value="{$vo.id}">{$vo.store_name}</option>
													{/volist}
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							            <div class="left">收银员：</div>
							            <div class="right clearfix">
							                <div id="htselect">
												<select name="syylist" id='syylist'>
												<option value="">全部</option>
													{volist name="clerk_list" id="vo"}
														<option value="{$vo.id}">{$vo.name}</option>
													{/volist}
												</select>
											</div>
							            </div>
							        </div>
								</div>
								<div class="chax_rowbox clearfix">
									<div class="shxx_row clearfix">
							            <div class="left">支付方式：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="pay_type" id="pay_type">
													<option value="">全部</option>
													<option value="1">现金</option>
													<option value="2">微信</option>
													<option value="3">支付宝</option>
													<option value="4">银联</option>
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							            <div class="left">支付项目：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="sy_type" id="sy_type">
													<option value="">全部</option>
													<option value="1">记账</option>
													<option value="2">扫码</option>
													<option value="3">商品</option>
												</select>
											</div>
							            </div>
							        </div> 
								</div>
								<div class="chax_rowbox clearfix">
									<div class="shxx_row clearfix">
							            <div class="left">交易状态：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="state" id="state">
													<option value="">全部</option>
													<option value="2">已付</option>
													<option value="1">未付</option>
												</select>
											</div>
							            </div>
							        </div>
							         <div class="shxx_row chax_row clearfix">
							            <div class="left">订单号：</div>
							            <div class="right clearfix">
							                <input type="text" name="order_sn" id="order_sn" placeholder="订单号" class="chax_input" />
							          	 </div>
						      		  </div>
							        <button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
								</div>
								</form>
								<div class="chax_conbox">
									<div class="chax_jiegbt clearfix">
										<div class="chax_jieg">消费金额：<?php echo $xfprice ? $xfprice:0.00 ?>元 ,实际金额：<?php echo $sjprice ? $sjprice:0.00 ?>元 ； 赠送：<?php echo $zsscore ? $zsscore:0.00 ?>元,抵扣：<?php echo $dkscore ? $dkscore:0.00 ?>元</div>
										<div class="chax_xzbtnbox">
											<a href="#" onclick="check()"><i class="iconfont icon-daochu"></i>导出</a>
										</div>
									</div>
									<div class="chax_jiegnr">
										<table class="zizh_table1">
											<thead>
												<tr>
													<th class="w_10">订单号</th>													
													<th class="w_10">门店</th>
													<th class="w_10">信息</th>
													<th class="w_10">支付方式</th>
													<th class="w_10">消费金额</th>
													<th class="w_10">实际金额</th>
													<th class="w_10">鼓励金</th>
													<th class="w_10">日期</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="paylog" id="vo" empty="$empty"}
												<tr>
													<td>{$vo.order_sn}</td>													
													<td>{$vo.store_name}</td>
													<td>{$vo.message}</td>
													<td>
													{switch name="$vo.pay_type"}
													    {case value="1"}现金{/case}
													    {case value="2"}微信{/case}
													    {case value="3"}支付宝{/case}
													    {case value="4"}银联{/case}
													    {default /}银联
													{/switch}
													</td>
													<td>{$vo['origin_price']}</td>
													<td>{$vo['balance']}</td>
													<td><?php echo sprintf("%.2f",substr(sprintf("%.3f", $vo['agent_score']), 0, -2)) ?></td>
													<td>{$vo.add_time}</td>
												</tr>
												{/volist}
											</tbody>
										</table>
										
										<div class="fenye" style="display: block;">
											<ul class="pagination">
												{$paylog->render()}
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
		
	</body>

</html>
<script type="text/javascript">
	layui.use('laydate', function(){
		var laydate = layui.laydate;
		
		//日期控件
		laydate.render({
		    elem: '#begin_time'
		    ,type: 'datetime'
		    ,format: 'yyyy-MM-dd HH:mm:ss'
		});
		  
		laydate.render({
		    elem: '#end_time'
		    ,type: 'datetime'
		    ,format: 'yyyy-MM-dd HH:mm:ss'
		});
	})
	
	function store_change(id){
		 $.ajax({
             	type:"post",
                url:"{:url('count/syylist')}",
                data: {
                	id:id
                },
                success:function(data){  
                	var syylist = data.data;
                    var select_htm = '';
					if(syylist && syylist.length<1){
						select_htm = "<option value=''>全部</option>";
					}else{
						for(var i=0;i<syylist.length;i++){
							select_htm = "<option value=''>全部</option>";
							select_htm += "<option value='"+syylist[i].id+"'>"+syylist[i].name+"</option>";
						}
					}
					$('#syylist').empty();
					$('#syylist').append(select_htm);

                },error:function(data){
                	var a = data;
                }
        });
	}
	
	function check() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();		
		var store_name = $('#store_name').val();
		var syylist = $('#syylist').val();
		var pay_type = $('#pay_type').val();
		var sy_type = $('#sy_type').val();
		var state = $('#state').val();
		var order_sn = $('#order_sn').text();
		window.location.href = "/agent/count/detail_dc.html?begin_time=" + begin_time + "&end_time=" + end_time+ "&store_name=" + store_name
		+ "&syylist=" + syylist + "&pay_type=" + pay_type + "&sy_type=" + sy_type + "&state=" + state + "&order_sn=" + order_sn;
	}
</script>